Skip to main content
This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal

Notes/Domino 8 Forum

Notes/Domino 8 Forum

Previous Next

Code Sample

Hi Paul,
I've included a working code sample you can modify to use your credentials and tables.
==================================================
Option Public
Uselsx "*LSXODBC"

Sub Initialize
' Holy... Cow! exported 1600 contacts to MySQL in a few seconds
Dim con As New ODBCConnection
Dim qry As New ODBCQuery
Dim result As New ODBCResultSet
Dim workspace As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Set uidoc = workspace.CurrentDocument
Set qry.Connection = con
Set result.Query = qry
Set session = New NotesSession
Set db = session.CurrentDatabase
Set view = db.GetView("MySQLTest")
'connects to the database
con.ConnectTo("NOFTest")

'queries the table Contacts.
qry.SQL = "SELECT * FROM Contact"

'result is what temp stores the value and is pointing to the execute command.
result.Execute

Set doc = view.GetFirstDocument
While Not(doc Is Nothing)

'If the value is empty then get the next document else get the document that you are pointing at.
' If result.IsValueNull(uidoc.CurrentField) Then
' Set doc = view.GetNextDocument(doc)

'update the value and adds it to the row
result.AddRow
Call result.SetValue("First_Name",doc.FirstName(0))
Call result.SetValue("Last_Name",doc.LastName(0))
Call result.SetValue("Company_Name",doc.Company(0))
result.UpdateRow
Set doc = view.GetNextDocument(doc)
'Else
'result.AddRow
'Call result.SetValue("FirstName",doc.FirstName(0))
'Call result.SetValue("LastName",doc.LastName(0))
'Call result.SetValue("Company",doc.Company(0))
'result.UpdateRow
'Set doc = view.GetNextDocument(doc)
' End If
Wend
result.Close(DB_CLOSE)
con.Disconnect
End Sub
================================================


Feedback response number WEBB8A9HAA created by ~Michelle Asafreepullen on 10/15/2010

LS to SQL - Can read, but not updat... (~Lisa Elreterob... 14.Oct.10)
. . SQL error (~Michelle Asafr... 14.Oct.10)
. . . . Error Information (~Lisa Elreterob... 15.Oct.10)
. . . . . . Code Sample (~Michelle Asafr... 15.Oct.10)
. . . . . . . . Sorted! (~Lisa Elreterob... 19.Oct.10)




Printer-friendly

Search this forum

Member Tools


RSS Feeds

 RSS feedsRSS
All forum posts RSS
All main topics RSS